﻿#ifndef CALENDAR_H
#define CALENDAR_H

#include <QDialog>
#include <QMouseEvent>
#include <QListView>
#include <QDate>
#include <QNetworkRequest>
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QJsonArray>
#include <QJsonDocument>
#include <QJsonObject>
#include <QJsonValue>
#include <QGraphicsDropShadowEffect>
#include <QDebug>

#include "dayitem.h"
#include "date.h"

namespace Ui {
class Calendar;
}

const QString KeyVal = "&key=xxxxxxxxxxx";

class Calendar : public QDialog
{
    Q_OBJECT

public:
    explicit Calendar(QWidget *parent = 0);
    ~Calendar();

    void setYear(int nYear){m_nYear = nYear;}
    void setMonth(int nMonth){m_nMonth = nMonth;}
    void setDay(int nDay){m_nDay = nDay;}
    int year(){return m_nYear;}
    int month(){return m_nMonth;}
    int day(){return m_nDay;}

    //跳转
    void JumpTo(int year, int month, int day);

    QByteArray HttpRequest(int year, int month, int day);

private slots:
    void on_pushButton_clicked();
    void on_day_clicked(DayItem* item);

    void on_toolButton_3_clicked();

    void on_toolButton_2_clicked();

    void on_toolButton_clicked();

    void on_comboBox_2_currentIndexChanged(int index);

    void on_comboBox_currentIndexChanged(int index);

    void on_comboBox_2_activated(int index);

    void on_comboBox_activated(int index);

    void on_comboBox_3_activated(int index);

protected:
    void mousePressEvent(QMouseEvent *event);
    void mouseMoveEvent(QMouseEvent *event);
    void mouseReleaseEvent(QMouseEvent *event);

private:
    Ui::Calendar *ui;
    bool m_bPress;
    QPoint m_startPos;
    DayItem* m_item[42];
    int m_nYear;
    int m_nMonth;
    int m_nDay;

};

#endif // CALENDAR_H
